package com.abaaba.project2.controller.wxcontroller;

import com.abaaba.project2.bean.Brand;
import com.abaaba.project2.bean.vo.BaseRespVo;
import com.abaaba.project2.bean.vo.BrandPageVo;
import com.abaaba.project2.bean.vo.wx.WxBrandDetailVo;
import com.abaaba.project2.service.WxBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/brand")
public class WxBrandController {

    @Autowired
    WxBrandService wxBrandService;

    @RequestMapping("/list")
    public BaseRespVo list(Integer page,Integer size) {
        BrandPageVo brandPageVo = wxBrandService.queryBrand(page, size);
        return BaseRespVo.ok(brandPageVo);
    }

    @RequestMapping("/detail")
    public BaseRespVo detail(Integer id) {
        Brand brand = wxBrandService.queryBrandDetail(id);

        // Issac : start
        WxBrandDetailVo wxBrandDetailVo = new WxBrandDetailVo();
        wxBrandDetailVo.setBrand(brand);

        return BaseRespVo.ok(wxBrandDetailVo);
        // Issac : end

        /*return BaseRespVo.ok(brand);*/
    }
}
